package com.itasura.flyweight;

import java.util.HashMap;

/**
 * @author sailor wang
 * @date 2020/7/1 7:07 PM
 * @description
 */
public class ShapeFactory {
    private static final HashMap<String,Shape> circleMap = new HashMap<>();

    public static Shape getCircle(String color){
        Circle circle = (Circle) circleMap.get(color);
        if (circle == null){
            circle = new Circle(color);
            circleMap.put(color,circle);
        }
        return circle;
    }
}